import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-10-11
 * Time: 22:15
 */
//这里要机上注解-->url的路径path
@WebServlet("/hello")
public class HelloServlet extends HttpServlet {

    //重写doGet方法
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //一定要删除掉,否则会调用系统中的方法
        //super.doGet(req, resp);
        //相当于是在控制台上->在服务器输出hello,world
        System.out.println("字节");
        //让其在页面上显示
        resp.getWriter().println("字节");
    }
}
